home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / starfi_1 / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-09-08  |  11.4 KB  |  332 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H0000C0C0&
  5.    BorderStyle     =   0  'None
  6.    Caption         =   "Form1"
  7.    ClientHeight    =   4815
  8.    ClientLeft      =   1920
  9.    ClientTop       =   2640
  10.    ClientWidth     =   5445
  11.    Height          =   5220
  12.    KeyPreview      =   -1  'True
  13.    Left            =   1860
  14.    LinkTopic       =   "Form1"
  15.    ScaleHeight     =   4815
  16.    ScaleWidth      =   5445
  17.    ShowInTaskbar   =   0   'False
  18.    Top             =   2295
  19.    Width           =   5565
  20.    Begin VB.PictureBox picTitlemsk 
  21.       Appearance      =   0  'Flat
  22.       AutoRedraw      =   -1  'True
  23.       AutoSize        =   -1  'True
  24.       BackColor       =   &H80000005&
  25.       ForeColor       =   &H80000008&
  26.       Height          =   1440
  27.       Left            =   2400
  28.       Picture         =   "Form1.frx":0000
  29.       ScaleHeight     =   94
  30.       ScaleMode       =   3  'Pixel
  31.       ScaleWidth      =   359
  32.       TabIndex        =   3
  33.       Top             =   3180
  34.       Visible         =   0   'False
  35.       Width           =   5415
  36.    End
  37.    Begin VB.PictureBox picTitle 
  38.       Appearance      =   0  'Flat
  39.       AutoRedraw      =   -1  'True
  40.       AutoSize        =   -1  'True
  41.       BackColor       =   &H80000005&
  42.       ForeColor       =   &H80000008&
  43.       Height          =   1440
  44.       Left            =   2280
  45.       Picture         =   "Form1.frx":18CD2
  46.       ScaleHeight     =   94
  47.       ScaleMode       =   3  'Pixel
  48.       ScaleWidth      =   359
  49.       TabIndex        =   2
  50.       Top             =   1560
  51.       Visible         =   0   'False
  52.       Width           =   5415
  53.    End
  54.    Begin VB.Timer Timer1 
  55.       Interval        =   20
  56.       Left            =   0
  57.       Top             =   1380
  58.    End
  59.    Begin VB.PictureBox picWork 
  60.       Appearance      =   0  'Flat
  61.       AutoRedraw      =   -1  'True
  62.       BackColor       =   &H00000000&
  63.       DrawWidth       =   2
  64.       FillColor       =   &H0000FF00&
  65.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  66.          Name            =   "MS Sans Serif"
  67.          Size            =   12
  68.          Charset         =   0
  69.          Weight          =   400
  70.          Underline       =   0   'False
  71.          Italic          =   0   'False
  72.          Strikethrough   =   0   'False
  73.       EndProperty
  74.       ForeColor       =   &H0000FF00&
  75.       Height          =   555
  76.       Left            =   540
  77.       ScaleHeight     =   35
  78.       ScaleMode       =   3  'Pixel
  79.       ScaleWidth      =   59
  80.       TabIndex        =   1
  81.       Top             =   1500
  82.       Visible         =   0   'False
  83.       Width           =   915
  84.    End
  85.    Begin VB.PictureBox picScreen 
  86.       Appearance      =   0  'Flat
  87.       AutoRedraw      =   -1  'True
  88.       BackColor       =   &H00000000&
  89.       DrawWidth       =   4
  90.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  91.          Name            =   "MS Sans Serif"
  92.          Size            =   13.5
  93.          Charset         =   0
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       ForeColor       =   &H0000FF00&
  100.       Height          =   1335
  101.       Left            =   0
  102.       ScaleHeight     =   87
  103.       ScaleMode       =   3  'Pixel
  104.       ScaleWidth      =   787
  105.       TabIndex        =   0
  106.       Top             =   0
  107.       Width           =   11835
  108.       Begin VB.Frame Frame1 
  109.          Height          =   1335
  110.          Left            =   0
  111.          TabIndex        =   4
  112.          Top             =   0
  113.          Width           =   1755
  114.          Begin VB.CommandButton Command1 
  115.             Caption         =   "&Exit"
  116.             Height          =   315
  117.             Left            =   480
  118.             TabIndex        =   5
  119.             Top             =   960
  120.             Width           =   675
  121.          End
  122.          Begin VB.Label Label1 
  123.             BackColor       =   &H00C0C0C0&
  124.             Caption         =   "DOWN"
  125.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  126.                Name            =   "MS Sans Serif"
  127.                Size            =   9.75
  128.                Charset         =   0
  129.                Weight          =   400
  130.                Underline       =   0   'False
  131.                Italic          =   0   'False
  132.                Strikethrough   =   0   'False
  133.             EndProperty
  134.             ForeColor       =   &H000000FF&
  135.             Height          =   255
  136.             Index           =   3
  137.             Left            =   480
  138.             TabIndex        =   9
  139.             Top             =   660
  140.             Width           =   675
  141.          End
  142.          Begin VB.Label Label1 
  143.             Caption         =   "RIGHT"
  144.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  145.                Name            =   "MS Sans Serif"
  146.                Size            =   9.75
  147.                Charset         =   0
  148.                Weight          =   400
  149.                Underline       =   0   'False
  150.                Italic          =   0   'False
  151.                Strikethrough   =   0   'False
  152.             EndProperty
  153.             Height          =   255
  154.             Index           =   2
  155.             Left            =   900
  156.             TabIndex        =   8
  157.             Top             =   420
  158.             Width           =   675
  159.          End
  160.          Begin VB.Label Label1 
  161.             Caption         =   "LEFT"
  162.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  163.                Name            =   "MS Sans Serif"
  164.                Size            =   9.75
  165.                Charset         =   0
  166.                Weight          =   400
  167.                Underline       =   0   'False
  168.                Italic          =   0   'False
  169.                Strikethrough   =   0   'False
  170.             EndProperty
  171.             Height          =   255
  172.             Index           =   1
  173.             Left            =   120
  174.             TabIndex        =   7
  175.             Top             =   420
  176.             Width           =   615
  177.          End
  178.          Begin VB.Label Label1 
  179.             Alignment       =   2  'Center
  180.             BackColor       =   &H00C0C0C0&
  181.             Caption         =   "UP"
  182.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  183.                Name            =   "MS Sans Serif"
  184.                Size            =   9.75
  185.                Charset         =   0
  186.                Weight          =   400
  187.                Underline       =   0   'False
  188.                Italic          =   0   'False
  189.                Strikethrough   =   0   'False
  190.             EndProperty
  191.             ForeColor       =   &H000000FF&
  192.             Height          =   315
  193.             Index           =   0
  194.             Left            =   480
  195.             TabIndex        =   6
  196.             Top             =   180
  197.             Width           =   615
  198.          End
  199.       End
  200.    End
  201. Attribute VB_Name = "Form1"
  202. Attribute VB_Creatable = False
  203. Attribute VB_Exposed = False
  204. Option Explicit
  205. Private Sub Command1_Click()
  206. Unload Me
  207. End Sub
  208. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  209. Select Case KeyCode
  210.     Case KEY_LEFT ' stars will scroll left.
  211.         KeyStats = 1
  212.         Label1(0).ForeColor = &H404080
  213.         Label1(1).ForeColor = &HFF&
  214.         Label1(2).ForeColor = &H404080
  215.         Label1(3).ForeColor = &H404080
  216.     Case KEY_UP
  217.         KeyStats = 2 ' stars will scroll up.
  218.         Label1(0).ForeColor = &HFF&
  219.         Label1(1).ForeColor = &H404080
  220.         Label1(2).ForeColor = &H404080
  221.         Label1(3).ForeColor = &H404080
  222.     Case KEY_RIGHT
  223.         KeyStats = 3 ' stars will scroll right.
  224.         Label1(0).ForeColor = &H404080
  225.         Label1(1).ForeColor = &H404080
  226.         Label1(2).ForeColor = &HFF&
  227.         Label1(3).ForeColor = &H404080
  228.     Case KEY_DOWN
  229.         KeyStats = 4 ' stars will scroll down.
  230.         Label1(0).ForeColor = &H404080
  231.         Label1(1).ForeColor = &H404080
  232.         Label1(2).ForeColor = &H404080
  233.         Label1(3).ForeColor = &HFF&
  234. End Select
  235. End Sub
  236. Private Sub Form_Load()
  237. 'set up the form
  238. Me.Height = Screen.Height
  239. Me.Width = Screen.Width
  240. Me.Top = 0
  241. Me.Left = 0
  242. 'set up the work picutre box
  243. picWork.Top = 0
  244. picWork.Left = 0
  245. picWork.Height = Screen.Height
  246. picWork.Width = Screen.Width
  247. picWork.ScaleMode = 3
  248. 'set up the screen picutre box
  249. picScreen.Top = 0
  250. picScreen.Left = 0
  251. picScreen.Height = Me.Height
  252. picScreen.Width = Me.Width
  253. picScreen.ScaleMode = 3
  254.  ' set the number of stars in field
  255. Int_Star
  256. 'set the direction the stars will travel
  257. KeyStats = 1
  258. 'set the color of the label for which direction the stars will travel
  259. Label1(0).ForeColor = &H404080
  260. Label1(1).ForeColor = &HFF&
  261. Label1(2).ForeColor = &H404080
  262. Label1(3).ForeColor = &H404080
  263. End Sub
  264. Public Sub Int_Star()
  265. Dim a As Integer ' used for FOR loop.
  266. Dim b As Integer ' used for ramdom star number.
  267. For a = 0 To NUMBER_STARS - 1
  268.     Randomize Timer
  269.     ' get a random x,y position
  270.     ' screen.height & screen.Width are in twips use / Screen.TwipsPerPixelX
  271.     ' and / Screen.TwipsPerPixelY to get the pixels ( / = devide by ).
  272.     tStar(a).x = ((Screen.Height / Screen.TwipsPerPixelX) * Rnd) + 1
  273.     tStar(a).y = ((Screen.Width / Screen.TwipsPerPixelY) * Rnd) + 1
  274.       
  275.     ' pick a random number betwwen 1 - 3
  276.     b = 3 * Rnd + 1
  277.     If b = 1 Then
  278.         tStar(a).color = &H808080
  279.         tStar(a).Speed = 5
  280.     ElseIf b = 2 Then
  281.          tStar(a).color = &HC0C0C0
  282.          tStar(a).Speed = 10
  283.     Else
  284.          tStar(a).color = &HC0C0&
  285.          tStar(a).Speed = 15
  286.     End If
  287.    Next
  288. End Sub
  289. Private Sub picScreen_DblClick()
  290. 'hmmmm you really are checking out this code :)
  291. ' reset the stars at ramdom postions and start scrolling again.
  292. Int_Star
  293. End Sub
  294. Private Sub Timer1_Timer()
  295. Dim rc As Integer
  296. Dim a As Integer
  297. picWork.Cls
  298. Select Case KeyStats
  299.     Case 1
  300.           For a = 0 To NUMBER_STARS - 1
  301.            picWork.PSet (tStar(a).x, tStar(a).y), tStar(a).color
  302.            tStar(a).x = tStar(a).x - tStar(a).Speed
  303.            If tStar(a).x < 0 Then tStar(a).x = Screen.Width / Screen.TwipsPerPixelX
  304.          Next
  305.     Case 2
  306.           For a = 0 To NUMBER_STARS - 1
  307.            picWork.PSet (tStar(a).x, tStar(a).y), tStar(a).color
  308.            tStar(a).y = tStar(a).y - tStar(a).Speed
  309.            If tStar(a).y < 0 Then tStar(a).y = picWork.ScaleHeight
  310.          Next
  311.     Case 3
  312.          For a = 0 To NUMBER_STARS - 1
  313.           picWork.PSet (tStar(a).x, tStar(a).y), tStar(a).color
  314.           tStar(a).x = tStar(a).x + tStar(a).Speed
  315.           If tStar(a).x > Screen.Width / Screen.TwipsPerPixelX Then tStar(a).x = 0
  316.         Next
  317.          
  318.          
  319.         
  320.   Case 4
  321.         For a = 0 To NUMBER_STARS - 1
  322.            picWork.PSet (tStar(a).x, tStar(a).y), tStar(a).color
  323.            tStar(a).y = tStar(a).y + tStar(a).Speed
  324.            If tStar(a).y > picWork.ScaleHeight Then tStar(a).y = 0
  325.          Next
  326.   End Select
  327.     rc = BitBlt(picWork.hDC, 180, 180, picTitlemsk.ScaleWidth, picTitlemsk.ScaleHeight, picTitlemsk.hDC, 0, 0, SRCAND)
  328.     rc = BitBlt(picWork.hDC, 180, 180, picTitle.ScaleWidth, picTitle.ScaleHeight, picTitle.hDC, 0, 0, SRCPAINT)
  329.     picScreen.Cls
  330.     rc = BitBlt(picScreen.hDC, 0, 0, picWork.ScaleWidth, picWork.ScaleWidth, picWork.hDC, 0, 0, SRCCOPY)
  331. End Sub
  332.